package com.wbl.train.common.feign;

import com.wbl.train.common.business.vo.TrainVo;
import com.wbl.train.common.feign.fallback.BusinessFeignFallBack;
import com.wbl.train.common.result.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.time.LocalDate;
import java.util.List;

/**
 * Author: 王博纶
 * Date: 2024/2/14 15:47
 * FileName: BusinessFeign
 * Description: 业务模块的feign接口
 */
@FeignClient(name = "business-service", path = "/business/admin", fallback = BusinessFeignFallBack.class)
//@FeignClient(name = "business-service", url = "http://127.0.0.1:8090/business/admin")
public interface BusinessFeign {

    @GetMapping("/test/hello")
    String hello();

    /**
     * 生成每日车次数据
     * @param date 生成的日期
     */
    @GetMapping("/daily-train/gen-daily/{date}")
    R<Boolean> genTrain(@PathVariable @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate date);

    /**
     * 获取所有的火车车次信息
     */
    @GetMapping("/train/query_all")
    R<List<TrainVo>> getAll();

    /**
     * 根据火车车次生成火车座位信息
     * @param trainCode 火车车次编号
     */
    @GetMapping("/train/generate-seat/{trainCode}")
    void generateCarriageAndSeat(@PathVariable String trainCode);

}
